import { CascadePickerView } from 'antd-mobile'
import React, { useState } from 'react'
import FilterFooter from '../../../../components/FilterFooter'

export default function FilterPicker(props) {
  const [value, setValue] = useState(props.defaultValue)
  const { data, onCancel, onSave } = props

  return (
    <>
      {/* 选择器组件 */}
      <CascadePickerView options={data} value={value} onChange={value => setValue(value)} />

      {/* 底部按钮 */}
      <FilterFooter
        onCancel={onCancel}
        onOk={() => {
          onSave(value)
        }}
      />
    </>
  )
}
